import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: lahiru
 * Date: 3/27/14
 * Time: 1:44 PM
 * To change this template use File | Settings | File Templates.
 */
public class Test2 {
    public static final double log2 = Math.log(2);

    public static void main(String[] args) {
//        int count = 0;
//        for (int i=0; i<10; i++){
//            for(int j=i+1; j<10; j++){
//                System.out.println("The pair is " + i + " " + j);
//                count = count + 1;
//            }
//        }

        List<Double> clusterDistances = new ArrayList<Double>(10);
        System.out.println(clusterDistances.get(8));


        System.exit(0);

        int[][] threeDimArr = {{1, 2}, {3, 4}, {5, 6}, {7, 8}};
        System.out.println(threeDimArr[0][0]);
        System.out.println(threeDimArr[0][1]);
        System.out.println(threeDimArr[0].length);
        System.out.println(threeDimArr[3][0]);
        System.out.println(threeDimArr[3][1]);
//        System.out.println(threeDimArr[0][0]);
//        System.out.println(threeDimArr[0][0]);
//        System.out.println(threeDimArr[0][0]);
//        System.out.println(threeDimArr[0][0]);

        String str = "011 014 016 017 018 019 01b 01d 01f 01j 01k 01m 01p 01q 01u 027 028 02c 02e 204 013 " +
                "015 01e 01g 01i 01l 01r 01t 01w 01y 01z 020 021 024 026 029 02b 207 208 20c";

        List<String> items = Arrays.asList(str.split(" "));

        for (String s : items) {
//            System.out.println(s);
        }

//        System.out.println("size " + items.size());
//        double p1 = 0.23243455;
//        double p2 = 0.353453435;

//        System.out.println(" p1 p2 " + klDivergence(p1,p2));
//        System.out.println(" p2 p1 " + klDivergence(p2,p1));
    }

    public static double klDivergence(double p1, double p2) {


        double klDiv = 0.0;

        if (p1 == 0.0 || p2 == 0.0) {
            return klDiv;
        } else {
            return ((p1 * Math.log(p1 / p2)) + (1 - p1 * Math.log(1 - p1 / 1 - p2))) / log2;
        }

    }
}
